//
//  ViewController.swift
//  表情键盘
//
//  Created by MACBOOK on 16/10/15.
//  Copyright © 2016年 刘袭锐. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    
    @IBOutlet weak var textView: UITextView!
    /// 防止循环引用 [weak self]
    fileprivate lazy var emoticonVc : LXREmoticonController = LXREmoticonController { [weak self] (emoticon) in
        self?.textView.insertEmoticon(emoticon : emoticon)
    }
    

    
    override func viewDidLoad() {
        super.viewDidLoad()
        textView.inputView = emoticonVc.view
        
    }
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        textView.becomeFirstResponder()
    }

}

extension ViewController{
    
    @IBAction func sendBtnClick(_ sender: AnyObject) {
        //FIXME: 把textView字符串+表情 转化为 字符串
        print(textView.getEmoticonString())
    }
}
